#pragma once

namespace UTIL {

/**
 * Observer Helper using windows PostMessage
 */
class ObserverHelper
{
public:
	/**
	 * Post nEvent message to window with pszObserverClassFilter prefix.
	 */
	static void NotifyObservers(LPCTSTR pszObserverClassFilter, UINT nEvent, WPARAM wParam = 0, LPARAM lParam = 0);

private:
	ObserverHelper(LPCTSTR pszObserverClassFilter, UINT nEvent, WPARAM wParam, LPARAM lParam);

	void Notify(HWND hwnd);

private:
	LPCTSTR m_pszObserverClassFilter;
	size_t  m_nObserverClassPrefixLength;

	UINT m_nEvent;
	WPARAM m_wParam;
	LPARAM m_lParam;

private:
	static BOOL CALLBACK NotifyAllWindowsProc(HWND hwnd, LPARAM lParam);
	static BOOL CALLBACK NotifyChildWindowsProc(HWND hwnd, LPARAM lParam);
};

}; //namespace UTIL
